cmake_minimum_required(VERSION 3.2)

project(quarkts_tests)

# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILE ON)

# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Build the static library
add_subdirectory(src)

# Include directories for all targets
include_directories(src)

# 现有测试
add_executable (simple_dry_test check/simple_dry_test.cpp)
target_include_directories(simple_dry_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(simple_dry_test quarkts-cpp)

# 新添加的测试用例
add_executable (comprehensive_test check/comprehensive_test.cpp)
target_include_directories(comprehensive_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(comprehensive_test quarkts-cpp)

add_executable (basic_task_test check/basic_task_test.cpp)
target_include_directories(basic_task_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(basic_task_test quarkts-cpp)

add_executable (fsm_timer_test check/fsm_timer_test.cpp)
target_include_directories(fsm_timer_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(fsm_timer_test quarkts-cpp)

# 新创建的测试用例
add_executable (coroutine_advanced_test check/coroutine_advanced_test.cpp)
target_include_directories(coroutine_advanced_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(coroutine_advanced_test quarkts-cpp)

add_executable (realtime_scheduling_test check/realtime_scheduling_test.cpp)
target_include_directories(realtime_scheduling_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(realtime_scheduling_test quarkts-cpp)

# setCoreIdleFcn 测试用例
add_executable (set_core_idle_test check/set_core_idle_test.cpp)
target_include_directories(set_core_idle_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(set_core_idle_test quarkts-cpp)

# 主测试程序
add_executable (main_test check/main.cpp)
target_include_directories(main_test PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(main_test quarkts-cpp)

# CLI示例程序
add_executable (cli_example check/cli_example.cpp)
target_include_directories(cli_example PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(cli_example quarkts-cpp)

# HighPrecisionTimer 示例程序
add_executable (high_precision_timer_example examples/high_precision_timer_example.cpp)
target_include_directories(high_precision_timer_example PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(high_precision_timer_example quarkts-cpp)

# Job-Task Architecture 示例程序
add_executable (job_task_architecture_example examples/job_task_architecture_example.cpp)
target_include_directories(job_task_architecture_example PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(job_task_architecture_example quarkts-cpp)

# Install configuration
install(TARGETS quarkts-cpp
        ARCHIVE DESTINATION lib
        LIBRARY DESTINATION lib
        RUNTIME DESTINATION bin)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/include/
        DESTINATION include
        FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")
